#pragma once
#include <vector>
#include <map>
#include "NodeMap.h"
#include "Agent.h"
#include "Fare.h"

#define MAX_FARES 25

typedef std::map<int, std::map<int, double>> TrafficMap;

class CEnv
{
public:
    CEnv(const CString& mapfile);
    ~CEnv(void);
    void Step(int ms);
    void SpawnCarAgent();
    void SpawnFares();
    void SpawnTaxiAgent();
    CNodeMap* GetNodeMap();
    CNodePtrVec* GetNodes();
    CAgentPtrVec* GetAgents();
    CFarePtrVec* GetFares();
    CFare* GetClosestFare(CNode* node);
    CString GetMapDesc();
    int GetNumCars();
    int GetAgentSpeed();
    void SetAgentSpeed(int val);
    double GetTrafficModifier(CNode* from, CNode* to);

protected:
    CNode* GetRandomNode();
    int GetNodeDist(CNode* n1, CNode* n2);
    //void Prepare();
    void UpdateAgents(int ms);
    void UpdateFares(int ms);
    //void UpdateTraffic();
    //double GetNodeTraffic(CNode* from, CNode* to);

	CFarePtrVec m_vecFares;
    CAgentPtrVec m_agents;
    CNodeMap m_map;
    CString m_strDesc;
    int m_nextAgentId;
    int m_numCars;
    int m_pps;
    TrafficMap m_traffic;
    int m_nextColor;
};
